import * as api from '../config/api.js'
export async function reoladUser(){
	let that = this;
	let leaveUserNum = uni.getStorageSync('leaveUserNum')
	if(leaveUserNum != ''){
		this.$store.commit('setLeaveUserNum',leaveUserNum)
		// 发送查询请求 重新渲染用户信息到vuex
		await api.getUserByIdApi(leaveUserNum,{
			data:{},
			success:res =>{
				if(res.code == 200){
					// console.log(res)
					uni.setStorageSync('leaveUser',res.data)
					that.$store.commit('setUser',res.data)
					// console.log(this.$store.getters.getUser)
					// console.log(that.$store.getters.getUser)
					// that.$store.getters.getUser
				}else{
					uni.showToast({
						title:"信息获取失败,请重新登陆",
						icon:"none",
						success(res){
							uni.reLaunch({
							    url: '/pages/index/login.vue'
							});
						}
					})
				}
			},
			fail:err =>{
				console.log("失败")
			}
		})
	}else{
		uni.reLaunch({
		    url: '/pages/index/login.vue'
		});
	}
}